<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin" style="padding: 20px 30px 0 0;">

    <input type="hidden" value="{$info.wf_fid ?? ''}" name="wf_fid">
    <input type="hidden" value="{$info.wf_type ?? ''}" name="wf_type">
    <input type="hidden" value="{$flowinfo.flow_id ?? ''}" name="flow_id">
    <input type="hidden" value="{$flowinfo.flow_process ?? ''}" name="flow_process">
    <input type="hidden" value="{$flowinfo.run_id ?? ''}" name="run_id" id='run_id'>
    <input type="hidden" value="{$flowinfo.run_process ?? ''}" name="run_process">
    {if condition='$flowinfo.status.wf_mode != 2'}
    <input type="hidden" value="{$flowinfo['nexprocess']['id'] ?? ''}" name="npid">
    {else/}
    <input type="hidden" value="{$flowinfo.process.process_to ?? ''}" name="npid">
    {/if}
    <input type="hidden" value="{$flowinfo.wf_mode ?? ''}" name="wf_mode">

    <input type="hidden" value="{$_GET['sup'] ?? ''}" name="sup">
    <div class="layui-form-item">
        <label class="layui-form-label">审批意见</label>
        <div class="layui-input-block">
            <input type="text" name="check_con" required="required"  lay-verify="check_con" placeholder="请输入审批意见" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item" id='nex_process'>
        <label class="layui-form-label">下一步骤</label>
        <div class="layui-input-block">
            {if condition='$flowinfo.wf_mode == 2'}[同步]{/if}

            {if condition='$flowinfo.status.wf_mode != 2'}
                {if condition='$flowinfo.nexprocess.auto_person != 3'}
                    <input type="text" required="required" value="{$flowinfo['nexprocess']['process_name']}({$flowinfo['nexprocess']['todo']})" readonly placeholder="请输入流程代码" autocomplete="off"
                   class="layui-input">
                {else/}
                    <span class="select-box">
						<select name="todo" id='todo'  class="select"  datatype="*" >
						<option value="">请指定办理人员</option>
						{volist name='$flowinfo.nexprocess.todo.ids' id='todo'}
						<option value="{$todo}*%*{$flowinfo['nexprocess']['todo']['text'][$key]}">{$flowinfo['nexprocess']['todo']['text'][$key]}</option>
						{/volist}
						</select>
                {/if}
			{else/}
                <!--同步模式-->
					{volist name='$flowinfo.nexprocess' id='v'}
						{$v['process_name']}({$v['todo']})<br/>
					{/volist}
			{/if}
        </div>
    </div>
    <div class="layui-form-item" style='display:none' id='back_process'>
        <label class="layui-form-label">回退步骤</label>
        <div class="layui-input-block">
            	<span class="select-box">
					<select name="wf_backflow" id='backflow'  class="select"  datatype="*" onchange='find()'>
					<option value="">请选择回退步骤</option>
					{volist name='$flowinfo.preprocess' id='back'}
					<option value="{$key}">{$back}</option>
					{/volist}
					</select>
					<input type="hidden" value="" name="btodo" id='btodo'>
				</span>
        </div>
    </div>
    <div class="layui-form-item" style='display:none' id='sing_process'>
        <label class="layui-form-label">会签步骤</label>
        <div class="layui-input-block">
            	<span class="select-box">
					<select name="wf_singflow" id='singflow'  class="select"  datatype="*" >
					<option value="">请选择会签人</option>
					{volist name='$flowinfo.singuser' id='sing'}
					<option value="{$sing.id}">{$sing.nickname}</option>
					{/volist}
					</select>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            {if condition='$flowinfo.sing_st == 0'}
<!--            <a class="layui-btn" id='nexbton' onclick='tj("ok")' >提交</a>-->
            {if condition='$flowinfo.process.is_back != 2'}
            <a class="layui-btn" id='backbton' onclick='tj("back")'value='back' >回退</a>
            {/if}
            {if condition='$flowinfo.process.is_sing != 2'}
            <a class="layui-btn" id='singbton' onclick='tj("sing")' value='sing' >会签</a>
            {/if}
            <a class="layui-btn" id='bupload'onclick="layer_show('上传','{:url(\'wfup\', [\'id\' => \'upload\'])}','140','160')">附件</a>
            {else/}

            <a class="layui-btn" id='backbton' onclick='sing("sback")'value='back' >会签回退</a>
            <a class="layui-btn" id='singbton' onclick='sing("ssing")' value='sing' >再会签</a>
            {/if}
        </div>
    </div>
    <div class="layui-form-item" style="margin-left: 30px">
        <fieldset class="layui-elem-field">
            <legend>审批记录</legend>
            <div class="layui-field-box"  id="table">

            </div>
        </fieldset>
    </div>

    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="LAY-user-back-submit" id="LAY-user-back-submit" value="确认">
    </div>
</div>
<script src="/static/admin/layui/layui.js"></script>
<script src="/static/admin/js/jquery.min.js"></script>
<script>
    layui.config({
        base: '/static/admin/' //静态资源所在路径
    }).extend({
        index: 'lib/index', //主入口模块
    }).use(['index', 'form'], function () {
        var $ = layui.$, form = layui.form;
        form.render();
        $.ajax({
            url:"{:url('flow/wflogs')}",
            type:'post',
            data:{'id':'{$info.wf_fid}','wf_type':'{$info.wf_type}'},
            success:function (res) {
                $('#table').append(res);
            }
        });
    });
    function tj(value){
        if(value =='back'){
            $('#nex_process').hide();//
            $('#nexbton').hide();
            $('#singbton').hide();
            // $('#backbton').html('确认回退');
            $('#back_process').show();
            var select = $('#backflow option:selected').val();
            $("#singflow").removeAttr("datatype");
            if(select==''){
                layer.msg('请选择回退步骤');
                return false;
            }
        }
        if(value =='sing'){
            $('#nex_process').hide();//
            $('#nexbton').hide();
            $('#backbton').hide();
            // $('#backbton').html('确认会签');
            $('#sing_process').show();
            $("#backflow").removeAttr("datatype");
            var select = $('#singflow option:selected').val();
            if(select==''){
                layer.msg('请选择会签人');
                return false;
            }
        }
        if(value =='ok'){
            $("#backflow").removeAttr("datatype");
            $("#singflow").removeAttr("datatype");
        }
        $('#submit_to_save').val(value);
        $('#forms').submit();
    }
    function sing(value){
        if(value =='sback'){
            $('#nex_process').hide();//
            $('#nexbton').hide();
            $('#singbton').hide();
            // $('#backbton').html('确认回退');
            $('#back_process').show();
            var select = $('#backflow option:selected').val();
            $("#singflow").removeAttr("datatype");
            if(select==''){
                layer.msg('请选择回退步骤');
                return false;
            }
        }
        if(value =='ssing'){
            $('#nex_process').hide();//
            $('#nexbton').hide();
            $('#backbton').hide();
            // $('#backbton').html('确认会签');
            $('#sing_process').show();
            $("#backflow").removeAttr("datatype");
            var select = $('#singflow option:selected').val();
            if(select==''){
                layer.msg('请选择会签人');
                return false;
            }
        }
        if(value =='sok'){
            $("#backflow").removeAttr("datatype");
            $("#singflow").removeAttr("datatype");
        }
        $('#submit_to_save').val(value);
        $('#forms').submit();
    }
</script>

